<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<div style="width: 640px;">
	<a class="layui-btn layui-btn-sm"
		href="javascript:loadPage('busLine/showAdd');"><i
		class="layui-icon">&#xe608;</i> 新增线路</a>
	<table class="layui-table" style="text-align: center;">
		<colgroup>
			<col width="60">
			<col width="100">
			<col width="100">
			<col width="100">
			<col width="80">
			<col>
		</colgroup>
		<thead>
			<tr>
				<th style="text-align: center">序号</th>
				<th style="text-align: center">线路名称</th>
				<th style="text-align: center">起点</th>
				<th style="text-align: center">终点</th>
				<th style="text-align: center">票价</th>
				<th style="text-align: center">操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${busLineList }" var="item" varStatus="status">
				<tr>
					<td>${status.count }</td>
					<td>${item.lineName }</td>
					<td>${item.startStation }</td>
					<td>${item.endStation }</td>
					<td>${item.ticketPrice }</td>
					<td><a class="layui-btn layui-btn-primary layui-btn-sm"
						href="javascript:loadPage('busLine/showUpd?lineId=${item.lineId }');">
						<i class="layui-icon">&#xe642;</i> 编辑</a>
						<button class="layui-btn layui-btn-primary layui-btn-sm"
							onclick="javascript:confirmDelete(this);"
							data-id="${item.lineId }">
							<i class="layui-icon">&#xe640;</i> 删除
						</button></td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
</div>
<script>
	function confirmDelete(that) {
		var othis = $(that)
		layui.layer.confirm('真的要删除这个线路吗?', {
			icon : 3,
			title : '警告'
		}, function(index) {
			var lineId = othis.data('id');
			loadPage("busLine/del?lineId=" + lineId);
			layui.layer.close(index);
		});
	}
</script>